clear all;
clc;

iunit_epi_c=load('iunit_epi_adtech.txt');
iunit_epi=load('iunit_epi_octrode.txt'); % 1 mm above dura
iunit_sub2=load('iunit_sub2_adtech.txt');% 1 mm below dura
iunit_sub1=load('iunit_sub1_adtech.txt');% 1 mm above cord

% access resistance
ra_epi_c=1e-3*2./iunit_epi_c;
ra_epi=1e-3*2./iunit_epi;
ra_sub2=1e-3*2./iunit_sub2;
ra_sub1=1e-3*2./iunit_sub1;

mean(ra_epi_c,2)
mean(ra_epi,2)
mean(ra_sub2,2)
mean(ra_sub1,2)

% effects of theta (deviation from midline)
% rows: 1, 2, and 3 = theta of 0, -10, and -20, respectively
% (theta < 0 = clockwise rotation)
% columns 1-5 = patients 1-5
[h_epi_12,p1]=kstest2(ra_epi(1,:),ra_epi(2,:))
[h_epi_13,p1]=kstest2(ra_epi(1,:),ra_epi(3,:))
[h_sub2_12,p3]=kstest2(ra_sub2(1,:),ra_sub2(2,:))
[h_sub2_13,p4]=kstest2(ra_sub2(1,:),ra_sub2(3,:))
[h_sub1_12,p5]=kstest2(ra_sub1(1,:),ra_sub1(2,:))
[h_sub1_13,p6]=kstest2(ra_sub1(1,:),ra_sub1(3,:))

% effects of placement above and below dura
[h_epivssub1,p7]=kstest2(ra_epi(:),ra_sub1(:))
[h_epivssub2,p8]=kstest2(ra_epi(:),ra_sub2(:))
[h_sub1vssub2,p9]=kstest2(ra_sub1(:),ra_sub2(:))
